package com.bdqn.controller;

import com.bdqn.pojo.HisPatient;
import com.bdqn.pojo.HisRegistration;
import com.bdqn.service.HisPatientService;
import com.bdqn.service.HisRegistrationService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/hisRegistration")
public class HisRegistrationController {
    @Autowired
    HisRegistrationService hisRegistrationService;
    @PostMapping("/addHisRegistration")
    public int addHisRegistration(@RequestBody HisRegistration registration){
        int row = hisRegistrationService.addHisRegistration(registration);
        return row;
    }

    @GetMapping("getAll")
    public PageInfo<HisRegistration> getAll(int pageNum,int pageSize,String deptId,String name,String schedulingType,String subsectionType,String createTime){
        PageInfo<HisRegistration> pageInfo = hisRegistrationService.getAll(pageNum,pageSize,deptId,name,schedulingType,subsectionType,createTime);
        return pageInfo;
    }

    @GetMapping("all")
    public PageInfo<HisRegistration> page(int pageNum, int pageSize, String doctorName, String visitDate){
        PageInfo<HisRegistration> pageInfo=hisRegistrationService.page(pageNum,pageSize,doctorName,visitDate);
        return pageInfo;
    }
    @GetMapping("all2")
    public PageInfo<HisRegistration> page2(int pageNum, int pageSize, String doctorName){
        PageInfo<HisRegistration> pageInfo=hisRegistrationService.page2(pageNum,pageSize,doctorName);
        return pageInfo;
    }

    @GetMapping("chargeHisRegistration")
    public int chargeHisRegistration(String id){
        int row = hisRegistrationService.chargeHisRegistration(id);
        return row;
    }
    @GetMapping("refundHisRegistration")
    public int refundHisRegistration(String id){
        int row = hisRegistrationService.refundHisRegistration(id);
        return row;
    }
    //查询待就诊患者信息
    @GetMapping("queryWithMedicalList")
    public List<HisRegistration> queryWithMedicalList(){
        List<HisRegistration> registrationList = hisRegistrationService.queryWithMedicalList();
        return registrationList;
    }
    //查询就诊中患者信息
    @GetMapping("queryTheListOfVisitsInProgress")
    public List<HisRegistration> queryTheListOfVisitsInProgress(){
        List<HisRegistration> registrationList = hisRegistrationService.queryTheListOfVisitsInProgress();
        return registrationList;
    }
    //查询就诊完成患者信息
    @GetMapping("queryTheListOfCompletedMedicalVisits")
    public PageInfo<HisRegistration> queryTheListOfCompletedMedicalVisits(int pageNum,int pageSize){
        PageInfo<HisRegistration> registrationList = hisRegistrationService.queryTheListOfCompletedMedicalVisits(pageNum, pageSize);
        return registrationList;
    }
    @GetMapping("receiveAPatientForTreatment")
    public String receiveAPatientForTreatment(String id){
        String hisRegistration = hisRegistrationService.receiveAPatientForTreatment(id);
        return hisRegistration;
    }
    @GetMapping("/modifyReceiveAPatientForTreatment")
    public int modifyReceiveAPatientForTreatment(String id){
        int row = hisRegistrationService.modifyReceiveAPatientForTreatment(id);
        return row;
    }

    /**
     * 就诊完成
     */
    @GetMapping("concludePatientVisit")
    public int concludePatientVisit(String id){
        int row = hisRegistrationService.concludePatientVisit(id);
        return row;
    }
}
